<template>
	<view class="main collection-main">
		<NavigationBar title="我的收藏" />
		<scroll-view class="scroll-wrap" scroll-y="true" @scrolltolower="pullUpAction">
			<view class="list">
				<view class="list-item" v-for="i in goodsList" @click="jumpDetailsAction(i)">
					<view class="left">
						<image class="left-img" src="https://img14.360buyimg.com/mobilecms/s372x372_jfs/t1/170941/7/6788/305267/602b7423E7f236f1c/6fe86d12af61b421.jpg!q70.dpg.webp"></image>
					</view>
					<view class="right">
						<p class="name">凝野空2021新款女时尚名媛粗花呢高腰半身裙凝野空2021新款女时尚名媛粗花呢高腰半身裙</p>
						<p class="price">¥200.00</p>
						<p class="shop-name">汐颜服饰旗舰店</p>
						<p class="remove round flex-center" @click.stop.prevent="removeAction(i)">
							<span class="remove-text">移除</span>
						</p>
					</view>
				</view>
			</view>
			<view class="loadMore-box flex-center">
				<uni-load-more iconType="circle" :status="more"></uni-load-more>
			</view>
		</scroll-view>
		<uni-popup type="dialog" ref="popup">
			<uni-popup-dialog type="sussess" title="通知" content="喵喵,我他妈的还没做呀" :before-close="true" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script lang="ts">
	export default {
		data() {
			return {
				goodsList: [],
				scrollLock: false,
				more: 'loading'
			};
		},
		onLoad() {
			const _this:any = this
			_this.getGoodsListAction()
		},
		methods: {
			removeAction(i:any) {
				const _this:any = this
				_this.$refs.popup.open()
			},
			dialogConfirm(done: any) {
				console.log('点击确认');
				// 需要执行 done 才能关闭对话框
				done()
			},
			dialogClose(done: any) {
				done()
			},
			pullUpAction() {
				const _this:any = this
				if(_this.scrollLock) return
				_this.scrollLock = true
				_this.getGoodsListAction()
				
				
				// console.log('==加载更多==')
			},
			async getGoodsListAction() {
				const _this:any = this
			    let params = {}
			    let res = await _this.axios.post(_this.api.getGoodsList)
				if (res.code==200) {
					let list = res.data
			       _this.goodsList = _this.goodsList.concat(list)
				   _this.scrollLock = false
				}
			},
			jumpDetailsAction(i:any) {
				const _this:any = this
				_this.$util.jumpPage('/pages/goodsDetails/goodsDetails')
			}
		}
	}
</script>

<style lang="scss">
	@import  './collection.scss'
</style>
